Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exchanges: Okx Update #1420

Open
wants to merge 134 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
1c049bb
update acccount ratelimits and added missing endpoints
samuael Nov 7, 2023
5ba4043
completed mapping missing trade accoung REST endpoints and Rate Limit
samuael Nov 8, 2023
57ebd02
added orderbook trading missing REST endpoints
samuael Nov 10, 2023
372a0be
Added few missing endpoints and unit tests
samuael Nov 11, 2023
b448b2d
Completed grid trading and signal bot trading with unit tests
samuael Nov 12, 2023
c8ec145
Added Recurring Buy endpoints and corresponding unit tests
samuael Nov 13, 2023
de333e1
Added copy trading endpoints and unit tests
samuael Nov 14, 2023
474b7ee
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 15, 2023
5e44c1c
added newly added block trading and spread endpoints
samuael Nov 17, 2023
b25bca0
completed mapping spread endpoints
samuael Nov 18, 2023
6444789
Added new endpoints and unit tests
samuael Nov 19, 2023
02581e0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 23, 2023
29c2901
Added round 1: Okx types and converts update.
samuael Nov 23, 2023
af5a97b
Update endpoints handling and types update
samuael Nov 25, 2023
3112408
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 25, 2023
9d19df1
Removed constants, updated unit tests, and updated endpoint methods
samuael Nov 26, 2023
8cbcca1
Slight endpoint and unit test update
samuael Nov 26, 2023
716c294
Added spread and other websocket endpoints and update
samuael Nov 29, 2023
a8e6f43
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 29, 2023
770b878
completed Spread WS Orderbook handler
samuael Nov 29, 2023
32a0bce
Added missing spread channels and handlers
samuael Nov 30, 2023
1a7f33c
Adding Bussinss websocket and missing subscriptions, update unit test…
samuael Dec 3, 2023
fe3c28e
Added spread endpoints to wrapper and unit tests update
samuael Dec 4, 2023
6a6cd71
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 4, 2023
42a9826
Added missing websocket subscriptions and copy trading endpoints
samuael Dec 9, 2023
b20386c
Added missing endpoints and re-organize business websocket handlers
samuael Dec 10, 2023
ddb379d
Docs update
samuael Dec 10, 2023
0bf59bc
Endpoints code updates
samuael Dec 11, 2023
7360c8e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 11, 2023
6c60fde
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 17, 2023
ab5ff5e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 22, 2023
b472922
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 31, 2023
7579c09
types, unit test and endpoints update
samuael Jan 15, 2024
3c6524f
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 15, 2024
340f5a8
Minor unit tests update
samuael Jan 21, 2024
44ce688
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 21, 2024
2834e29
spelling fix
samuael Jan 21, 2024
d7143fa
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 24, 2024
3c82295
fix unit test issues
samuael Jan 30, 2024
6ab81da
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jan 30, 2024
bdddb53
Updating unit tests error handling
samuael Feb 5, 2024
b4de8e5
Updating unit tests error handling
samuael Feb 5, 2024
41174d1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 8, 2024
c6d4274
Unit tests assertion handling update
samuael Feb 15, 2024
70f57b8
Unit tests update
samuael Feb 15, 2024
b971949
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 15, 2024
1ef68e5
Resolve linter issues
samuael Feb 16, 2024
f383383
linter issues fix
samuael Feb 16, 2024
960c2b3
Orderbook unit test error fix
samuael Feb 16, 2024
314d5b4
Minor fixes
samuael Feb 19, 2024
9a36a29
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 21, 2024
a20435b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Feb 28, 2024
03ad8e5
Change on test handling and types
samuael Feb 28, 2024
fdf7e4a
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 21, 2024
b6b2e3e
Updating unit tests and cleanups
samuael May 23, 2024
ede9af8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 28, 2024
54f3a0a
Fix unit test issues
samuael May 29, 2024
8106d20
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael May 29, 2024
efa96e8
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 10, 2024
4b4c518
Add ratelimit test and update unit tests and methods
samuael Jun 11, 2024
c647b48
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jun 22, 2024
40d97d0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Jul 12, 2024
e7c2b7c
Update method parameters and error declarations
samuael Jul 12, 2024
213888f
Added lending endpoints, unit tests, and update endpoint methods and …
samuael Jul 13, 2024
719f310
Update ratelimiters, add missing lending and trading endpoints and un…
samuael Jul 15, 2024
804b839
Update websocket authentication and subscription handling
samuael Jul 17, 2024
58685b5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 6, 2024
0c2265d
Minor update to unit test and types
samuael Sep 6, 2024
cfc8519
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Sep 24, 2024
fb7fa19
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 17, 2024
9a9711b
Types, error handling, and other minor updates
samuael Oct 17, 2024
d6dbee7
Update unit tests and endpoint functions
samuael Oct 19, 2024
7c07649
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 19, 2024
d388a4b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 25, 2024
980d30a
error declarations update and unit tests
samuael Oct 25, 2024
b8c5264
Overall update on unit endpoint, unit tests, and types
samuael Oct 29, 2024
95dc4e0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Oct 29, 2024
e406221
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 1, 2024
06300af
Adding review fixes
samuael Nov 1, 2024
82a77d0
Update on endpoints, order types, and unit tests
samuael Nov 2, 2024
6c08ec3
Update unit tests and endpoint functions
samuael Nov 3, 2024
439c460
Update on endpoint and update missing parameters
samuael Nov 4, 2024
9394e26
Implemented and tested newly added trading endpoints
samuael Nov 5, 2024
e877122
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 5, 2024
b77e1d8
endpoints update and unit tests
samuael Nov 6, 2024
0a55411
Update missing endpoints and update overall code
samuael Nov 7, 2024
14dd03a
added and testing funding and fiat related endpoints
samuael Nov 9, 2024
87c1a37
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 9, 2024
f003f9b
Update on convert and fiat related endpoints
samuael Nov 10, 2024
8985235
linter fix, types, endpoints, and unit tests update
samuael Nov 11, 2024
b3e7d71
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 11, 2024
736e267
linter issues fix
samuael Nov 11, 2024
30e576e
revert changes on tempos
samuael Nov 12, 2024
c00ce6d
Fix Panic and update websocket auth calls handling
samuael Nov 12, 2024
6266ad2
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 12, 2024
5ffd43f
config linter issue fix
samuael Nov 12, 2024
c16906d
Fix panic issues and update unit tests
samuael Nov 13, 2024
ef765f4
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 13, 2024
f5e0728
Fix race condition, TestAllExchangeWrappers unit test issues
samuael Nov 14, 2024
43624d7
Fix withdrawal manager test issue
samuael Nov 17, 2024
f6220a4
Rename ClosePositionForContractrID --> ClosePositionForContractID
samuael Nov 17, 2024
f75c7e5
Rename ClosePositionForContractrID --> ClosePositionForContractID
samuael Nov 17, 2024
d7a6065
Fix error
samuael Nov 17, 2024
5d1e0d7
endpoints update and fix unit test issues
samuael Nov 18, 2024
2e4e1a1
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 18, 2024
735728c
Merge branch 'okx_update' of https://github.com/samuael/gocryptotrade…
samuael Nov 18, 2024
567c9c3
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 20, 2024
f89574c
added unit tests, updated comments, and code sections
samuael Nov 21, 2024
36792ea
revert change in defaultSubscriptions
samuael Nov 21, 2024
c27d51b
few types comments update
samuael Nov 21, 2024
5a9edd5
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 25, 2024
90479fe
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Nov 28, 2024
22fdf03
Minor changes
samuael Nov 28, 2024
9bd5e7e
remove lending endpoints
samuael Dec 3, 2024
d485dcb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 3, 2024
b52b6d7
rm mistakenly added code
samuael Dec 3, 2024
5406298
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 5, 2024
53fe0c7
fix unit test
samuael Dec 5, 2024
084753b
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 7, 2024
cf31fb5
minor unit test fix
samuael Dec 9, 2024
1429501
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 9, 2024
62fac9c
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 12, 2024
d884ecb
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 16, 2024
121b6a0
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 17, 2024
18badd9
Adding offline error tests, update endpoints function, config update
samuael Dec 17, 2024
076719b
Update unit test coverage for offline error handliing
samuael Dec 18, 2024
7c1cb10
Updating wrapper algo order coverage, endpoint calls, and unit tests
samuael Dec 19, 2024
0291113
Updating wrapper trade functions to accomodate algo orders
samuael Dec 20, 2024
cdddf2e
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 21, 2024
53e09ce
update wrapper unit tests
samuael Dec 21, 2024
2df3ee7
Fix wrapper order functions offline errors handling
samuael Dec 22, 2024
d2ccc2d
Tested and updated wrapper order functions
samuael Dec 23, 2024
131126f
Address review comments
samuael Dec 23, 2024
54ac698
Merge branch 'master' of http://github.com/thrasher-corp/gocryptotrad…
samuael Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions exchanges/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
MarginFunding
Index
Binary
Spread
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to below the futures section since it involves at least one futures contract

// Futures asset consts must come below this comment for method `IsFutures`
Futures
PerpetualContract
Expand All @@ -43,16 +44,12 @@ const (
LinearContract
// Options asset consts must come below this comment for method `IsOptions`
Options
Spread
OptionCombo
// All asset const must come immediately after all valid assets for method `IsValid`
All
)

optionsFlag = OptionCombo | Options
futuresFlag = PerpetualContract | PerpetualSwap | Futures | DeliveryFutures | UpsideProfitContract | DownsideProfitContract | CoinMarginedFutures | USDTMarginedFutures | USDCMarginedFutures | LinearContract | FutureCombo
supportedFlag = Spot | Margin | CrossMargin | MarginFunding | Index | Binary | PerpetualContract | PerpetualSwap | Futures | DeliveryFutures | UpsideProfitContract | DownsideProfitContract | CoinMarginedFutures | USDTMarginedFutures | USDCMarginedFutures | Options | LinearContract | OptionCombo | FutureCombo | Spread

const (
spot = "spot"
margin = "margin"
crossMargin = "cross_margin"
Expand All @@ -73,6 +70,7 @@ const (
optionCombo = "option_combo"
futureCombo = "future_combo"
spread = "spread"
linearContract = "linearcontract"
all = "all"
)

Expand Down
1 change: 1 addition & 0 deletions exchanges/asset/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func TestNew(t *testing.T) {
{Input: "Future", Error: ErrNotSupported},
{Input: "option_combo", Expected: OptionCombo},
{Input: "future_combo", Expected: FutureCombo},
{Input: "spread", Expected: Spread},
{Input: "linearContract", Expected: LinearContract},
}

Expand Down
119 changes: 35 additions & 84 deletions exchanges/okx/okx.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion exchanges/okx/okx_business_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (ok *Okx) WsConnectBusiness() error {
Message: pingMsg,
Delay: time.Second * 20,
})
if ok.IsWebsocketAuthenticationSupported() {
if ok.Websocket.CanUseAuthenticatedEndpoints() {
err = ok.WsSpreadAuth(context.TODO())
if err != nil {
log.Errorf(log.ExchangeSys, "Error connecting auth socket: %s\n", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion exchanges/okx/okx_err_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var (
"59508": errors.New("the sub account of {0} is suspended"),
"59509": errors.New("account does not have permission to reset MMP status"),
"59510": errors.New("sub-account does not exist"),
"59512": errors.New("unable to set up this permission for ND brokers sub accounts. by default, all ND sub accounts can transfer funds out"),
"59512": errors.New("unable to set up this permission for 'ND' brokers sub accounts"),
"59601": errors.New("this sub-account name already exists, try another name"),
"59602": errors.New("number of API keys exceeds the limit"),
"59603": errors.New("number of sub accounts exceeds the limit"),
Expand Down
115 changes: 57 additions & 58 deletions exchanges/okx/okx_test.go

Large diffs are not rendered by default.

Loading
Loading